import { createApp } from 'vue'
//引入element-plus插件与样式
import ElementPlus from 'element-plus'
//全局国际化配置
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import 'element-plus/dist/index.css'
import App from './App.vue'
//引入svg图标
import 'virtual:svg-icons-register'
//引入全局样式
import '@/styles/index.scss'
// 引入全局组件配置
import gloablComponent from './index';
//引入路由
import router from './router/index'
//引入pinia
import pinia from './store/index'
//引入水印
import warterMark from '@/utils/waterMark';
import UUIDPlugin from '@/utils/uuid';
//引入路由鉴权文件
import './permisstion';
//获取应用实例对象
const app = createApp(App)

//全局安装element-plus插件
app.use(ElementPlus, {
    locale: zhCn,
  })
app.use(gloablComponent);
app.use(router)
app.use(pinia)
app.use(UUIDPlugin)
app.provide('uuidInstance', app.config.globalProperties.$uuid);

console.log(import.meta.env);

app.mount('#app')


router.afterEach((item) =>{
  console.log("路由守卫",item);
  
  if(item.name !== 'Login'){
      // warterMark.set(localStorage.getItem("display_name"))
      warterMark.set("罗志全")
  }else{
      warterMark.set('')
  }
})